﻿using System;
using System.Collections.Generic;

using System.Text;

namespace RoughJs.Helper
{
    public class MathKit
    {
        public static int foo(int x, int y)
        {
            int mask = 0x7fffffff;   //Integer.MAX_VALUE   
            for (int i = 0; i < y; i++)
            {
                x >>= 1;
                x &= mask;
            }
            return x;
        }
        public static long foo2(long x, long y)
        {
            long mask = long.MaxValue;   //Integer.MAX_VALUE   
            for (int i = 0; i < y; i++)
            {
                x >>= 1;
                x &= mask;
            }
            return x;
        }

        public static long[] divideAndRemainder(long first, long second)
        {
            long[] result = new long[2];
            result[0] = first / second;
            result[1] = first % second;
            return result;
        }
        public static int signum(long val)
        {
            if (val == 0)
                return 0;
            else if (val < 0)
                return -1;
            else
                return 1;
        }
    }
}
